package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstArticleShareLogDao;
import com.financing.wap.dto.DstArticleShareLogDTO;
import com.financing.wap.service.IDstArticleShareLogService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_article_share_log  
 * 分享记录 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstArticleShareLogService")
public class DstArticleShareLogServiceImpl implements IDstArticleShareLogService{

	@Autowired
	private IDstArticleShareLogDao dstArticleShareLogDao;

	@Override
	public int insert(DstArticleShareLogDTO dstArticleShareLog) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstArticleShareLog);
		DTOdateSetUtil.setUpdateInfo(dstArticleShareLog);
		dstArticleShareLog.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstArticleShareLogDao.insert(dstArticleShareLog);
	}

	@Override
	public void update(DstArticleShareLogDTO dstArticleShareLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstArticleShareLog);
		dstArticleShareLogDao.update(dstArticleShareLog);
	}

	@Override
	public void updateForce(DstArticleShareLogDTO dstArticleShareLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstArticleShareLog);
		dstArticleShareLogDao.updateForce(dstArticleShareLog);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstArticleShareLogDao.delete(id);
	}
	
	@Override
	public List<DstArticleShareLogDTO> queryList(DstArticleShareLogDTO dstArticleShareLog) throws SQLException {
		return dstArticleShareLogDao.queryList(dstArticleShareLog);
	}

	@Override
	public int queryListCount(DstArticleShareLogDTO dstArticleShareLog) throws SQLException {
		return dstArticleShareLogDao.queryListCount(dstArticleShareLog);
	}

	@Override
	public DstArticleShareLogDTO loadById(Integer id) throws SQLException {
		return dstArticleShareLogDao.loadById(id);
	}
 	@Override
	public DstArticleShareLogDTO queryListGetFirst(DstArticleShareLogDTO dstArticleShareLog)
			throws SQLException {
		 List<DstArticleShareLogDTO> queryList = queryList(dstArticleShareLog);
		 if(queryList==null||queryList.size()==0){
			 return new DstArticleShareLogDTO();
		 }
		 return queryList.get(0);
	}
}
